// export default usePersonHouseData;
import { reactive } from "vue";
import liaoning from "@/utils/liaoning.json";
import { number } from "echarts";

const usePersonHouseData = (): any => {
  // 数据部分
  const personHouseData = reactive<any>({
    // 开发建设
    getDevelopInvestmentData: {},
    getDevelopNewlyStartedData: {},
    // 商品房交易
    getHouseSalesAreaData: {},
    getHouseSalesAmountData: {},
    // 土地供应 左图2 土地出让金
    getLandTransferFeeData: {},
    getLandTransferFeeData1: {},
    //保教楼 - 停缓建
    getBjfDetailsData: {
      xms: {
        number: [0],
        style: {
          fontSize: 24,
          fill: "#0BDB8C",
        },
      },
      jfxms: {
        number: [0],
        style: {
          fontSize: 24,
          fill: "#08dbf2",
        },
      },
      fwts: {
        number: [0],
        style: {
          fontSize: 24,
          fill: "#60acff",
        },
      },
      jfts: {
        number: [0],
        style: {
          fontSize: 24,
          fill: "#fada4c",
        },
      },
      jfRate: {
        number: [0],
        content:'{nt}%',
        style: {
          fontSize: 14,
          fill: "#FFFFFF",
        },
      },
    },
    getThjDetailsData: {
      xms: {
        number: [0],
        style: {
          fontSize: 24,
          fill: "#0BDB8C",
        },
      },
      zmj: {
        number: [0],
        style: {
          fontSize: 24,
          fill: "#08dbf2",
        },
      },
      phNum: {
        number: [0],
        style: {
          fontSize: 24,
          fill: "#60acff",
        },
      },
      wphNum: {
        number: [0],
        style: {
          fontSize: 24,
          fill: "#fada4c",
        },
      },
      phRate: {
        number: [0],
        content:'{nt}%',
        style: {
          fontSize: 14,
          fill: "#FFFFFF",
        },
      },
    },
    // 商品房供给
    spfgjData: {},
    spfgjData1: {},
    // 房地产金融
    fdcjrData: {},
    fdcjrData1: {},
    // 中间地图
    personHouseMiddleData: {},
    dialogVisible: false,
    componentName: "",
    componentParams: {},
    cityName: "",
    // cityCode: localStorage.getItem("cityCode"),
    cityCode: 210000,
    data4: [],
    listTab: ["当月", "累计"],
    listInd1: 0,
    lj1: 0,
    tb1: 0,
    lj12: 0,
    tb12: 0,
    listInd2: 0,
    lj2: 0,
    tb2: 0,
    listInd3: 0,
    lj3: 0,
    tb3: 0,
    lj32: 0,
    tb32: 0,
    listInd4: 0,
    lj4: 0,
    tb4: 0,
    lj42: 0,
    tb42: 0,
    listInd5: 0,
    lj5: 0,
    tb5: 0,
  });

  let arr = liaoning.features.find((item: any) => item.properties.adcode == localStorage.getItem("cityCode"));
  const cityName = arr?.properties.name || "辽宁省";
  personHouseData.cityName = cityName;

  // 获取当前时间
  let date = new Date();
  let year = date.getFullYear();
  let month = date.getMonth() + 1;
  let startTime = year + "-01"; // 当前年的1月份
  let endTime = year + "-" + (month < 10 ? "0" + month : month);

  // 设置默认时间范围
  if (personHouseData) {
    personHouseData.data4 = [startTime, endTime];
  }
  return personHouseData;
};
export default usePersonHouseData;
